﻿using System.ComponentModel.DataAnnotations;
using Ewk.MachineLearning.Classification.Common;
using Ewk.MachineLearning.Classification.Interfaces;

namespace Ewk.MachineLearning.Persistance.Domain
{
    public abstract class TextEntity : Entity, ITextEntity
    {
        /// <summary>
        /// The content of the <see cref="TextEntity"/>.
        /// </summary>
        [Required(AllowEmptyStrings = false)]
        public string Content { get; set; }

        public bool EqualsForMachineLearning(ITextEntity other)
        {
            var comparer = new TextEntityComparer<ITextEntity>();
            return comparer.Equals(this, other);
        }

        string ITextEntity.Text
        {
            get { return Content; }
        }
    }
}